package cn.wolfcode.trip.base.domain;

import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.*;

/**
 * 酒店管理
 */
@Setter@Getter
@JsonIgnoreProperties("handler")
public class Grogshop extends BaseDomain{

    public final static int STATE_COMMON = 0;//普通
    public final static int STATE_HOT = 1;//推荐
    public final static int STATE_BARGAIN = 2;//特价
    public final static int STATE_DISABLE = -1;//禁用

    //酒店名称
    private String grogshopName;
    //入住价格
    private Double price;
    //酒店封面
    private String coverUrl;
    //入住时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd ",timezone = "GMT+8")
    private Date checkInTime;
    //离开时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd ",timezone = "GMT+8")
    private Date leaveTime;
    //所属地区
    private Region region;
    //地址
    private String site;
    //评分
    private Double grade;
    //酒店标签
    private List<GrogshopTag> grogshopTag=new ArrayList<>();
    //状态
    private Integer state=STATE_COMMON;

    private List<Room> room;

    private List<GrogshopRoom> grogshopRoom;

    private GrogshopComment grogshopComment;

    public String getStateString(){
        String temp = "普通";
        if(STATE_HOT==state){
            temp = "推荐";
        }else if(STATE_DISABLE==state){
            temp = "禁用";
        }else if (STATE_BARGAIN==state){
            temp= "特价";
        }
        return temp;
    }

   /* public String getJson(){
        Map<String, Object> map = new HashMap<>();
        map.put("id",id);
        if (region!=null){
            map.put("regionId",region.id);
        }
        return JSON.toJSONString(map);
    }*/

   /* public String getJson(){
        Map<String, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("grogshopName",grogshopName);
        map.put("price",price);
        map.put("coverUrl",coverUrl);
        map.put("regionId",region.id);
        map.put("regionName",region.getName());
        map.put("site",site);
        map.put("grade",grade);
        map.put("state",state);
        return JSON.toJSONString(map);
    }*/

}